<?php
require_once("http://localhost:8085/JavaBridge/java/Java.inc");
//require_once("Java.inc");
$System = java("compacktest.test");
echo "<pre>";
echo ($System->outString() );
echo "<pre>";
die();
// $System = java(" com.Controller");
// echo $System->outString();
// die();

$s = new Java("java.lang.String", "我在php中执行java");
echo $s;

die();

$input = new Java("com.ecc.emp.data.KeyedCollection");

$signDataput = new Java("com.ecc.emp.data.KeyedCollection");

$input->put("masterId","111111");

$input->put("orderId","222222");

$signDataput = $util->getSignData($input);

$orig = java_values($signDataput->getDataValue("orig"));

$sign = $signDataput->getDataValue("sign");

echo java_values($sign);
die();
//1、引用Java.inc
require_once("Java.inc");
//2、Java方法实例化
try{
    $util = new Java("com.sdb.payclient.core.PayclientInterfaceUtil");
    $input = new Java("com.ecc.emp.data.KeyedCollection","input");
    $signDataput = new Java("com.ecc.emp.data.KeyedCollection","signDataput");
    $urlEncoder = new Java("java.net.URLEncoder");
}catch(JavaException $e){
    echo "错误：实例化失败:<br/>",$e;
}
//3、对数据进行组装，然后生成orig和签名sign


    //组装数据到$input
    $input->put("masterId", $payment_masterId);
    $input->put("orderId", $payment_orderId);
    $input->put("currency", $payment_currency);
    $input->put("amount", $payment_amount);
    $input->put("paydate", $payment_paydate);
    $input->put("remark", $payment_remark);
    $input->put("objectName", $payment_objectName);
    $input->put("validtime", $payment_validtime);
    //设定初始值
    $orig = "";        //原始数据
    $sign = "";        //产生签名
    $encoding = "GBK";
    //获得orig与sign
    $signDataput = $util->getSignData($input);
    $orig = $signDataput->getDataValue("orig");
    $sign = $signDataput->getDataValue("sign");
    //对签名进行编码
    $orig = $util->Base64Encode($orig, $encoding);
    $sign = $util->Base64Encode($sign, $encoding);
    $orig = $urlEncoder->encode($orig, $encoding);
    $sign = $urlEncoder->encode($sign, $encoding);
?>